#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 100010;
int a[N], b[N], c[N];
int n;
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        b[i] = a[i] - a[i - 1];
    }
    int ans1 = 0, ans2 = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        c[i] = a[i] - a[i - 1];
        int ans = b[i] - c[i];
        if (ans >= 0) ans1 += ans;
        else ans2 -= ans;
    }
    cout << max(ans1, ans2) << endl;
    return 0;
}